﻿using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace yuejilalala
{
    public partial class home : System.Web.UI.Page
    {
        ProductCountMarager marager = new ProductCountMarager();
        ProductTypeMarager ProductType = new ProductTypeMarager();
        ProductMarager Product = new ProductMarager();
        StoreMarager store = new StoreMarager();
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {

                Repeater1.DataSource = marager.SumProductCount();
                Repeater1.DataBind();

                Repeater2.DataSource = ProductType.GetProductCount(1);
                Repeater2.DataBind();

                Repeater4.DataSource = Product.GetProductCount(Label2.Text);
                Repeater4.DataBind();

                //店铺
                Repeater5.DataSource = store.StoreCount();
                Repeater5.DataBind();

                Repeater6.DataSource = Product.GetProductCounts(Label2.Text);
                Repeater6.DataBind();

                Repeater7.DataSource = Product.GetProductCount(Label3.Text);
                Repeater7.DataBind();

                //店铺
                Repeater8.DataSource = store.StoreCount();
                Repeater8.DataBind();

                Repeater9.DataSource = Product.GetProductCounts(Label3.Text);
                Repeater9.DataBind();

                Repeater10.DataSource = Product.GetProductCount(Label4.Text);
                Repeater10.DataBind();

                //店铺
                Repeater18.DataSource = store.StoreCount();
                Repeater18.DataBind();

                Repeater12.DataSource = Product.GetProductCounts(Label4.Text);
                Repeater12.DataBind();

                Repeater13.DataSource = Product.GetProductCount(Label5.Text);
                Repeater13.DataBind();

                //店铺
                Repeater14.DataSource = store.StoreCount();
                Repeater14.DataBind();

                Repeater15.DataSource = Product.GetProductCounts(Label5.Text);
                Repeater15.DataBind();

                Repeater16.DataSource = Product.GetProductCount(Label6.Text);
                Repeater16.DataBind();

                //店铺
                Repeater17.DataSource = store.StoreCount();
                Repeater17.DataBind();

                Repeater11.DataSource = Product.GetProductCounts(Label6.Text);
                Repeater11.DataBind();

                Repeater19.DataSource = Product.GetProductCount(Label7.Text);
                Repeater19.DataBind();

                //店铺
                Repeater20.DataSource = store.StoreCount();
                Repeater20.DataBind();

                Repeater21.DataSource = Product.GetProductCounts(Label7.Text);
                Repeater21.DataBind();

                Repeater22.DataSource = Product.GetProductCount(Label8.Text);
                Repeater22.DataBind();

                //店铺
                Repeater23.DataSource = store.StoreCount();
                Repeater23.DataBind();

                Repeater24.DataSource = Product.GetProductCounts(Label8.Text);
                Repeater24.DataBind();

                Repeater25.DataSource = Product.GetProductCount(Label9.Text);
                Repeater25.DataBind();

                //店铺
                Repeater26.DataSource = store.StoreCount();
                Repeater26.DataBind();

                Repeater27.DataSource = Product.GetProductCounts(Label9.Text);
                Repeater27.DataBind();

                Repeater28.DataSource = Product.GetProductCount(Label10.Text);
                Repeater28.DataBind();

                //店铺
                Repeater29.DataSource = store.StoreCount();
                Repeater29.DataBind();

                Repeater30.DataSource = Product.GetProductCounts(Label10.Text);
                Repeater30.DataBind();


                Repeater31.DataSource = Product.GetProductCount(Label12.Text);
                Repeater31.DataBind();

                //店铺
                Repeater32.DataSource = store.StoreCount();
                Repeater32.DataBind();

                Repeater33.DataSource = Product.GetProductCounts(Label12.Text);
                Repeater33.DataBind();
            }

        }

        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = int.Parse(e.CommandArgument.ToString());
            Repeater2.DataSource = ProductType.GetProductCount(id);
            Repeater2.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string name = TextBox1.Text;
            Response.Redirect("search.aspx?name" + name);
        }
    }
}
